﻿using System;
using System.Web.UI.WebControls;
using Controller;

public partial class Modules_TickerControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindData(0);
        }
    }

    public void BindData(int pageNo)
    {
        var postController = new PostController();
        var data = postController.GetListPost();

        var pagedDataSource = new PagedDataSource
        {
            DataSource = data,
            AllowPaging = true,
            PageSize = 10,
            CurrentPageIndex = pageNo
        };

        repeaterTicker.DataSource = pagedDataSource;
        repeaterTicker.DataBind();
    }
}